package cn.da.shuai.cool.system.model.entity.user;

import cn.da.shuai.cool.common.annotation.CoolField;
import cn.da.shuai.cool.common.entity.EntityBase;
import cn.da.shuai.cool.common.view.BasicView;
import cn.da.shuai.cool.system.model.entity.dept.DeptUserDto;
import cn.da.shuai.cool.system.model.entity.dept.DeptUserVo;
import cn.da.shuai.cool.system.model.enums.user.GenderType;
import cn.da.shuai.cool.system.model.enums.user.UserStatusType;
import cn.da.shuai.cool.system.model.enums.user.UserType;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonView;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 系统用户表
 * </p>
 *
 * @author 大帅哥
 * @since 2025-01-03
 */
@Getter
@Setter
@TableName("cool_user")
@Schema(name = "用户数据", description = "系统用户表")
public class UserDto extends EntityBase {

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "姓名")
    @TableField("username")
    private String username;

    @Schema(description = "用户编号")
    @TableField("user_no")
    private String userNo;

    @Schema(description = "用户昵称")
    @TableField("nick_name")
    private String nickName;

    @Schema(description = "用户类型")
    @TableField("user_type")
    private UserType userType;

    @Schema(description = "邮箱")
    @TableField("email")
    private String email;

    @Schema(description = "手机号码(3des加密)")
    @TableField("phone")
    private String phone;

    @Schema(description = "性别 （-1未知 0男 1女 2未知）")
    @TableField("gender")
    private GenderType gender;

    @Schema(description = "帐号状态（1正常 2停用 3删除）")
    @TableField("status")
    private UserStatusType status;

    @Schema(description = "头像路径")
    private String avatar;

    @Schema(description = "最后登录ip")
    @TableField("last_login_ip")
    private String lastLoginIp;

    @Schema(description = "最后登录时间")
    @TableField("last_login_time")
    private LocalDateTime lastLoginTime;

    @Schema(description = "备注")
    @TableField("remark")
    private String remark;

    @JsonView(Detail.class)
    @CoolField(ignore = true)
    @Schema(description = "部门列表")
    private List<DeptUserDto> deptList;

    public interface Detail extends BasicView {}

}
